Teacher Version
Line Tracking Threshold
When the robot is line tracking, the color sensor detects the amount of reflected light from the surface under it. Dark surfaces absorb light, whereas bright surfaces reflect it.
Physical Robot users
-
Using the EV3's menu, navigate to the Brick App tab and select Port View. -
Use the port view on the EV3 and observe the value of the Color Sensor when it is set for Reflected Light (COL - REFLECTED). -
Place the robot so that the color sensor is over the black line and write down the value reported on the EV3's LCD screen. -
Then, move the robot so that the color sensor is over the white surface and write down the value reported on the EV3's LCD screen.
Virtual Robot users
-
Run the program and use the WASD keyboard keys to move the robot so it is over a black surface. -
Use the Robot > Debugger Windows > EV3 Remote Screen to see the value reported. Write it down. -
Use the WASD keyboard keys to move the robot so that it is over the white surface. Write down the value reported on the EV3 Remote Screen.
Quick Tip
To calculate the perfect threshold value for your environment:
Add the two values you recorded, and divide them by two.
Value on Black line = 21
Value on White surface = 133
Threshold = (133 + 21) / 2 = 154 / 2 = 77
For the most reliable results when line tracking, use this value in the second box of the lineTrackLeft and lineTrackRight command blocks.
What do you notice? How is this different from the original program?
Check Your Understanding
- The robot is attempting to line track a black line on a white surface. If the color sensor gives a reading above the threshold, what does this mean?
- The color sensor is over white.
- The color sensor is over black.
- The color sensor will never give a reading above the threshold.
- The threshold value is wrong.
- Your robot is right side line tracking. If the color sensor gets a value that is below the threshold, which way should the robot move?
- Forward and to the left
- Forward and to the right
- Straight forward because the line will curve eventually
- Turn right in place, because the right edge is that way